import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '任务名称',
    align:"center",
    dataIndex: 'taskName'
   },
   {
    title: '任务类型',
    align:"center",
    dataIndex: 'taskType_dictText'
   },
   {
    title: '采集站点',
    align:"center",
    dataIndex: 'taskSite_dictText'
   },
   {
    title: '采集页数',
    align:"center",
    dataIndex: 'taskPage'
   },
   {
    title: '排序',
    align:"center",
    dataIndex: 'taskSort_dictText'
   },
   {
    title: '采集维度',
    align:"center",
    dataIndex: 'taskDim_dictText'
   },
   {
    title: '是否采集文本',
    align:"center",
    dataIndex: 'taskJurdge_dictText'
   },
   {
    title: '采集文本',
    align:"center",
    dataIndex: 'taskCon'
   },
   {
    title: '采集状态',
    align:"center",
    dataIndex: 'taskStatus_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "任务类型",
      field: 'taskType',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"amazon_type"
      },
      //colProps: {span: 6},
 	},
	{
      label: "采集站点",
      field: 'taskSite',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"amazon_task_site,name,code"
      },
      //colProps: {span: 6},
 	},
	{
      label: "采集状态",
      field: 'taskStatus',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"amazon_task_status"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '任务名称',
    field: 'taskName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入任务名称!'},
          ];
     },
  },
  {
    label: '任务类型',
    field: 'taskType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"amazon_type"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入任务类型!'},
          ];
     },
  },
  {
    label: '采集站点',
    field: 'taskSite',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"amazon_task_site,name,code"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入采集站点!'},
          ];
     },
  },
  {
    label: '采集页数',
    field: 'taskPage',
    component: 'Input',
  },
  {
    label: '排序',
    field: 'taskSort',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"amazon_task_sort"
     },
  },
  {
    label: '采集维度',
    field: 'taskDim',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"amazon_task_dim"
     },
  },
  {
    label: '是否采集文本',
    field: 'taskJurdge',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"amazon_task_jurdge"
     },
  },
  {
    label: '采集文本',
    field: 'taskCon',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  taskName: {title: '任务名称',order: 0,view: 'text', type: 'string',},
  taskType: {title: '任务类型',order: 1,view: 'list', type: 'string',dictCode: 'amazon_type',},
  taskSite: {title: '采集站点',order: 2,view: 'list', type: 'string',dictTable: "amazon_task_site", dictCode: 'code', dictText: 'name',},
  taskPage: {title: '采集页数',order: 3,view: 'text', type: 'string',},
  taskSort: {title: '排序',order: 4,view: 'list', type: 'string',dictCode: 'amazon_task_sort',},
  taskDim: {title: '采集维度',order: 5,view: 'list', type: 'string',dictCode: 'amazon_task_dim',},
  taskJurdge: {title: '是否采集文本',order: 6,view: 'list', type: 'string',dictCode: 'amazon_task_jurdge',},
  taskCon: {title: '采集文本',order: 7,view: 'textarea', type: 'string',},
  taskStatus: {title: '采集状态',order: 8,view: 'list', type: 'string',dictCode: 'amazon_task_status',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}